package Cliente.interface_grafico;

import baralho.carta.Carta;

public class CartaPartilhada{
	private Carta carta;

	public CartaPartilhada(){
		this.carta = null;
	}

	public synchronized Carta getCarta(){
		while(this.carta == null){
			try {
				this.wait();
			} catch (InterruptedException e) {}
		}
		Carta c = this.carta;
		this.carta = null;
		return c;
	}

	public synchronized void setCarta(Carta carta){
		this.carta = carta;
		this.notifyAll();
	}
}